package com.mvvm.start.main.mvvm.v.adapter

import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.core.view.isVisible
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mvvm.start.main.R
import com.mvvm.start.main.bean.SwitchThemeBean

/**
 * @功能:任务列表的Adapter
 * @User Lmy
 * @Creat 2020/12/17 19:55
 * @Compony 永远相信美好的事情即将发生
 */
class SwitchThemeAdapter :
    BaseQuickAdapter<SwitchThemeBean, BaseViewHolder>(R.layout.switch_theme_item) {
    override fun convert(holder: BaseViewHolder, switchThemeBean: SwitchThemeBean) {
        addChildClickViewIds(R.id.cl_swtich_theme)
        bindViewClickListener(holder, holder.itemViewType)
        holder.apply {
            getView<View>(R.id.view_color).setBackgroundResource(switchThemeBean.color_value)
            getView<TextView>(R.id.tv_color).text = switchThemeBean.color_name
            getView<ImageView>(R.id.iv_select).isVisible = switchThemeBean.isselect
        }

    }
}